Setting the Font Size

You can specify a font size for the text appearing inside a specific HTML element on an HTML Web page, using the font-size property. For example, you can specify three different font sizes, 20, 15, and 10, for the text appearing at three different heading levels.

Let’s do the following steps to set the font size of the text present on an HTML Web page.


<!DOCTYPE html>
<html>
<head>
<title>Setting the Font Size</title>
    <style type=”text/css”>
    h1 {font-size: 20}
    h2 {font-size: 15}
    h3 {font-size: 10}
    </style>
</head>
<body>
    <h1>The font size of this text is 20.</h1>
    <h2>The font size of this text is 15.</h2>
    <h3>The font size of this text is 10.</h3>
</body>
</html>

Save the document with the name FontSize.html and open on browser.